package com.demo.cloud.h2.controller;

import com.demo.cloud.h2.bo.StaffBo;
import com.demo.cloud.h2.service.IStaffService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping(path="/staff",produces="application/json;charset=utf-8")
public class StaffController {
    private static final Logger logger= LoggerFactory.getLogger(StaffController.class);

    @Autowired
    private IStaffService staffService;

    @RequestMapping("/getList/info")
    @ResponseBody
    public List<StaffBo> getAllList(Long t){
        List<StaffBo> staffList=null;
        try {
            logger.info(t.toString());
            staffList = staffService.queryAllStaffList();
            logger.info("获取数据数量：{}",staffList.size());
        } catch (Exception e) {
            logger.error("查询失败");
        }
        return staffList;
    }

}
